package com.clz.appdesign.myapp;


import com.clz.appdesign.appdependence.net.bean.BaseEntity;
import com.clz.appdesign.appdependence.net.config.URLConfig;
import com.clz.appdesign.myapp.bean.ABean;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

/**
 * @author yemao
 * @date 2017/4/9
 * @description API接口!
 */

public interface APIFunction2 {

    @GET(URLConfig.baidu_url)
    Observable<BaseEntity<ABean>> getBaidu(@Query("wd") String name);

    @GET("index")
    Observable<BaseEntity<WeatherBean>> getBaidu1(@QueryMap Map<String, Object> params);

    @POST(URLConfig.login_token_url)
    Call<String> loginByToken(@Query("mobile") String mobile, @Query("token") String cookie);

    //上传单张图片
    @POST("服务器地址")
    Observable<Object> imageUpload(@Part() MultipartBody.Part img);

    //上传多张图片
    @POST("服务器地址")
    Observable<Object> imagesUpload(@Part() List<MultipartBody.Part> imgs);

    @Streaming
    @GET
    rx.Observable<ResponseBody> download(@Url String url);//直接使用网址下载
}
